<template>
  <!-- 主煤流运行监测 -->
  <HerinContainer
    class="MainCoal-box"
    :delay="1"
    direction="Right"
    title="变电所运行概况"
  >
    <!-- tab按钮 -->
    <div slot="tab" class="MainCoal-box-tab">
      <div
        v-for="(item, i) in titletab"
        :key="i"
        :class="['btn', isbtn === item ? 'isbtn' : '']"
        @click="clickTitleTab(item)"
      >
        {{ item }}
      </div>
    </div>
    <!-- 内容区 -->
    <div slot="content" class="MainCoal-box-content">
      <div class="list">
        <div class="list-content">
          <div v-for="(item,index) in data" :key="index" class="content-item">
            <CommonCard
            :lists="item.data"
            :cardTitle="item.title"
            :num="item.num"
            ></CommonCard>
          </div>
        </div>
      </div>
    </div>
  </HerinContainer>
</template>

<script>
import HerinContainer from '@/components/HerinContainer';
import CommonCard from '../common/CommonCardV2.vue';
import { upLists, downLists } from './data';
export default {
  components: {
    HerinContainer,
    CommonCard
  },
  data() {
    return {
      titletab: ['井上', '井下'],
      isbtn: '井上',
      data: []
    };
  },
  mounted() {
    this.data = upLists;
  },
  methods: {
    clickTitleTab(item) {
      this.isbtn = item;
      item === '井上' ? this.data = upLists : this.data = downLists;
    }
  }
};
</script>

<style lang='scss' scoped>
.MainCoal-box {
  &-tab {
    display: flex;
    .btn {
      @include btn;
    }
    .isbtn {
      background-color: rgba(0, 228, 255, 0.2);
      color: $cyan;
    }
  }
  .list{
    position: relative;
    .list-content{
      width: calc(100% + 10px);
      padding-right: 0.4375rem;
      height:57.5rem;
      overflow: auto;
    }
  }
  .content-item{
    margin-bottom: 1.875rem;
  }
  .content-item:last-child{
    margin-bottom: 0;
  }
}
</style>
